package com.pro.controller;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;

import com.pro.beans.Menu;
import com.pro.beans.User;
import com.pro.dao.UserDao;
import com.pro.param.RequestParam;

@Controller
public class IndexController {

	@Resource
	public UserDao userDao;
	@RequestMapping("enterLogin")
	public String enterLogin(){
		return "login";
	}
	@RequestMapping("index.do")
	public String index(@ModelAttribute("requestParam")RequestParam requestParam,Model model,HttpServletRequest request){
		System.out.println(">>>>>>pageNo:"+request.getParameter("page.count"));
		System.out.println(">>>>>>pageCount:"+request.getParameter("page.pageNo"));
		String jspName = request.getParameter("jspName");
		String id = (String)request.getParameter("id");
		if(id!=null && !id.equals("")){
			User user = userDao.getObject(Integer.valueOf(id));
			model.addAttribute("user", user);
		}
		return "index";
	}
}
